Skip to content

Conversation

@marius-pelegrin-arm
Copy link
Contributor

This PR is a reduction of #2507 to a more easily reviewable series of commits. It contains only handling of vkFrameBoundaryANDROID using the polymorphic behavior of VulkanSwapchain and doesn't contain any other type of offscreen frame boundary conversion.

vkFrameBoundaryANDROID is a non-standard Vulkan call (it does not belong to the core nor to any registered extension) used by some Android applications to present a AHardwareBuffer to the screen.
In particular, Android UI applications present to the screen using this call.

Currently, when the call is simply forwarded to the driver when encountered by the replayer.
The issue is that this call only actually presents to the screen when a AHardwareBuffer-bound image is submitted. However, at replay time, the AHardwareBuffer is often (always, as far as I encountered) impossible to recreate in the exact same way - and the issue gets worse when replaying on a different platform. Thus, even if the image is properly rendered and the call forwarded, the screen remains black - even on the exact same device.

This commit tries to fix this by considering the vkFrameBoundaryANDROID call like an additional vkQueuePresentKHR call.
The call is treated by the polymorphic VulkanSwapchain that decides whether to create a window a present to it (virtual swapchain behavior) or forward the call (offscreen/default swapchain behavior).

@marius-pelegrin-arm marius-pelegrin-arm requested a review from a team as a code owner January 23, 2026 16:13
@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 630626.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8684 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8684 passed.

@fabian-lunarg fabian-lunarg self-assigned this Jan 26, 2026
@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 632210.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8695 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8695 passed.

@fabian-lunarg fabian-lunarg force-pushed the android-frame-boundary-handling branch from 5323a9a to 24597c2 Compare January 27, 2026 17:12
@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 633325.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8713 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8713 passed.

@fabian-lunarg fabian-lunarg force-pushed the android-frame-boundary-handling branch from 24597c2 to c3de7cb Compare January 28, 2026 14:28
@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 634035.

Copy link
Contributor

@fabian-lunarg fabian-lunarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy with this now in terms of code-changes.
I did not get to reproduce actual replays using FrameBoundaryANDROID
and we're not adding test-coverage here, since this appears to require a capture-based test.

also I added some changes myself,
so need somebody to have a final look @bradgrantham-lunarg / @MarkY-LunarG :)

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8721 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 634073.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8722 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8722 passed.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 635164.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8736 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8736 passed.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 637687.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8759 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8759 passed.

marius-pelegrin-arm and others added 8 commits February 3, 2026 13:36
`VulkanSwapchain::CreateSurface` doesn't need that many arguments,
as most of them are just forwarding of replay options.
In particular some options are badly forwarded (window size),
some default value for options are set as constants in the
Vulkan swapchain header for no reason etc.

This commit tries to clean that a bit to make it more readable
and maintainable.

Change-Id: If260bc8e112df91815ca0ee7480190e2f28ee587
`vkFrameBoundaryANDROID` is a non-standard Vulkan call (it does
not belong to the core nor to any registered extension) used by
some Android applications to present a `AHardwareBuffer` to the
screen.
In particular, Android UI applications present to the screen
using this call.

Currently, when the call is simply forwarded to the driver when
encountered by the replayer.
The issue is that this call only actually presents to the screen
when a `AHardwareBuffer`-bound image is submitted. However, at
replay time, the `AHardwareBuffer` is often (always, as far as I
encountered) impossible to recreate in the exact same way - and
the issue gets worse when replaying on a different platform.
Thus, even if the image is properly rendered and the call
forwarded, the screen remains black - even on the exact same
device.

This commit tries to fix this by considering the
`vkFrameBoundaryANDROID` call like an additional
`vkQueuePresentKHR` call.
The call is treated by the polymorphic `VulkanSwapchain` that
decides whether to create a window a present to it (virtual
swapchain behavior) or forward the call (offscreen/default
swapchain behavior).

Change-Id: If3dc05d52824547b14c0fe0c35311d4764c98826
- properly handle multiple devices and allow to cleanup adhoc resources.

the VulkanSwapchain::Clean() method override was not possible, because it is invoked
after all devices are already destroyed.
so this required to add a virtual VulkanSwapchain::CleanDeviceResources(VkDevice)
and attach that in VulkanReplayConsumerBase::OverrideDestroyDevice and FreeAllLiveObjects.
@fabian-lunarg fabian-lunarg force-pushed the android-frame-boundary-handling branch from 1c5d16c to 0730776 Compare February 3, 2026 12:36
@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 638708.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8774 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8774 passed.

@fabian-lunarg fabian-lunarg merged commit 9716852 into LunarG:dev Feb 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants